﻿@{
    ViewBag.Title = "createInfo";
    Layout = "~/Views/Shared/Houyun.cshtml";
}
<script>
    $(function () {
        $('#Starttime').datetimepicker({
            format: 'yyyy-mm-dd hh:ii',
            //minView: "month", //选择日期后，不会再跳转去选择时分秒
            //format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
            language: 'zh-CN', //汉化
            autoclose: true //选择日期后自动关闭
            @*startDate: @DateTime.Now;*@
        });

        //鼠标悬浮时间
        $('#article-property-tips').hover(function () {
            document.getElementById("article-property-tips-html").style.display = "";
        }, function () {
            document.getElementById("article-property-tips-html").style.display = "none";
        })

        $('#article-operate-save').click(function ()
        {
           var colid= $('#article-form #ColumnssID').val()
           
           var lid = $('#article-form #lableID').val()
           
          
           if (colid == null || colid == "" || lid==null || lid=="") {
                alert("栏目或者标签不能为空");
                return false;
            }


        })
    })

    

</script>



<div class="page-header clearfix">
    <h1 class="pull-left">添加资讯</h1>
    <div class="pull-right">

    </div>
</div>
<style>
    #article-form .popover {
        max-width: 400px;
        width: 400px;
    }
</style>

<form class="two-col-form" id="article-form" method="post" enctype="multipart/form-data"
      action="/Group/addinfo">
    <div class="row">
        <div class="col-md-8">
            <div class="form-group">
                <label for="article-title-field" class="control-label">资讯标题</label>
                <div class="controls">
                    <input class="form-control" id="article-title-field" type="text" name="INTITLE" value="">
                </div>
            </div>

            <div class="form-group">
                <label for="categoryId" class="control-label">所属栏目</label>
                <div class="controls">
                    <select class="form-control" id="ColumnssID" type="text" name="ColumnssID" tabindex="2">
                        <option value="">-选择所属栏目-</option>
                        @foreach (var item in ViewBag.collist as List<LeEdu.MODEL.Columnss>)
                        {
                            <option value="@item.ColumnssID">@item.CLNAME</option>
                        }
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label for="article-tagIds" 　class="control-label">TAG标签</label>
                <div class="controls">
                    <select class="form-control" id="lableID" type="text" name="lableID " tabindex="2">
                        <option value="">-选择标签-</option>
                        @foreach (var item in ViewBag.lalist as List<LeEdu.MODEL.Lable>)
                        {
                            <option value="@item.LableId">@item.LableName</option>
                        }
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="richeditor-body-field" class="control-label">正文</label>
                <div class="controls">
                    <script id="container" name="INCONTENT" type="text/plain">
                    </script>
                    <script type="text/javascript">
                        var editor = UE.getEditor('container')
                    </script>
                 </div>
            </div>

        </div>
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">资讯属性</div>
                <div class="panel-body">
                    <label class="checkbox-inline">
                        <input type="checkbox" name="ATTRIBUTE" value="置顶"> 置顶
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="ATTRIBUTE" value="头条"> 头条
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="ATTRIBUTE" value="推荐"> 推荐
                    </label>
                    <a class="glyphicon glyphicon-question-sign text-muted pull-right" id="article-property-tips" data-toggle="tooltip" data-placement="bottom" href="javascript:" title="">
                    </a>
                    <div id="article-property-tips-html" style="display:none;">
                        <p>设为“<strong>置顶</strong>”后，该资讯将会显示在列表的最前面。</p>
                        <p>设为“<strong>头条</strong>”后，如果正文含有图片，则该资讯的第一张图片将显示在资讯首页的头条图片区，图片尺寸建议统一为：720*400。</p>
                        <p>设为“<strong>推荐</strong>”后，该资讯将会显示在页面右侧的推荐资讯中。</p>

                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">来源设置</div>
                <div class="panel-body">
                    <div class="form-group">
                        <label for="article-source-field">来源名称</label>
                        <div class="controls">
                            <input class="form-control" id="article-source-field" type="text" name="INSOURCENAME" value="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="article-sourceUrl-field">来源地址</label>
                        <div class="controls">
                            <input class="form-control" id="article-sourceUrl-field" type="text" name="INSOURCE" value="">
                        </div>
                    </div>
                </div>
            </div>

            @*<div class="panel panel-default">
                <div class="panel-heading">设置缩略图</div>
                <div class="panel-body">
                    <div id="article-thumb-container">
                    </div>
                    <br>
                    <a href="#modal" data-toggle="modal" data-target="#exampleModal" data-url="/admin/article/show/upload" class="btn btn-default">上传</a>
                    <a id="article_thumb_remove" class="btn btn-default" data-url="/admin/article/thumb/0/remove" style="display:none;">删除</a>
                    <input type="hidden" name="thumb" value="" id="article-thumb">
                    <input type="hidden" name="originalThumb" value="" id="article-originalThumb">
                    <p class="help-block">请上传png, gif, jpg格式的图片文件。</p>
                </div>
            </div>*@

            <div class="panel panel-default">
                <div class="panel-heading">发布时间</div>
                <div class="panel-body">
                    <div class="form-group">
                        <div class="controls">
                            <input class="form-control" id="INOLDTIME" type="text" readonly="readonly" name="INOLDTIME" value="@DateTime.Now" >
                            <div class="help-block">内容条目默认按发布时间的倒序显示</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <button id="article-operate-save" class="btn btn-primary"  data-toggle="form-submit" data-loading-text="正在保存...">确定</button>
            <a class="btn btn-link" href="/admin/article">返回</a>
        </div>
    </div>
</form>

@*添加图片*@
@*<div id="exampleModal" class="modal in" aria-hidden="false">
    <div class="modal-dialog  modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">设置资讯图片</h4>
            </div>
            <div class="modal-body">
                <form id="aticel-picture-form" class="form-horizontal" method="post" enctype="multipart/form-data" action="/admin/article/show/upload">
                    <div class="form-group">
                        <div class="col-md-2 control-label">
                        </div>
                        <div class="controls col-md-8 controls">
                            <p class="help-block">你可以上传JPG、GIF或PNG格式的文件，文件大小不能超过<strong>2M</strong>。</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-2 control-label"></div>
                        <div class="controls col-md-8 controls">
                            <img  src=""/>
                            <a id="article-upload-btn" data-goto-url="/admin/article/picture/crop" data-upload-token="NHx0bXB8aW1hZ2V8MTQ1MDcyMDczOXxiODQ4ZDcwOGI3MzM2MTI4NGEwZGUxODkxYjdlMDUzNA"
                               class="btn btn-primary webuploader-container" data-widget-cid="widget-6">
                                @*<div class="webuploader-pick webuploader-pick-hover">选择上传的文件</div>*@
                                @*<input id="File1" type="file" contextmenu="选择上传的文件" />
                                <div id="rt_rt_1a729u6bp6edkh1lq78q1b9e7" style="position: absolute; top: 6px; left: 12px; width: 98px; height: 20px; overflow: hidden; bottom: auto; right: auto;">
                                    <input type="file" name="file" class="webuploader-element-invisible" accept="image/*">
                                    <label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);">
                                    </label>
                                </div>
                            </a>
                            <input type="hidden" name="_csrf_token" value="44316ef59e0c82d4dc5ed3f0887f6ccf219ce7fc">
                        </div>
                    </div>

                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-link pull-left" data-dismiss="modal">确定</button>
                <button type="button" class="btn btn-link pull-right" data-dismiss="modal">取消</button>
                @*<script>app.load('article/picture-upload-modal')</script>*@
            @*</div>
        </div>
    </div>
</div>*@
<script>
    seajs.use(app.mainScript);
</script>
